package com.atguigu.spring5.service;

import com.atguigu.spring5.bean.Book;
import com.atguigu.spring5.dao.BookDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @date: 2021/12/9 11:13
 * @description:
 */
@Component
public class BookService {
    @Autowired
    private BookDao bookDao;

    public void addBook(Book book){
        bookDao.add(book);
    }

    public void updateBook(Book book){
        bookDao.update(book);
    }

    public void deleteBook(int id){
        bookDao.delete(id);
    }

    //查询记录数
    public int seleteCount(){
        return bookDao.seleteCount();
    }

    //查询
    public Book seleteBook(int id){
        return bookDao.selectBook(id);
    }


    public List<Book> selectAllBook(){
        return bookDao.selectAllBook();
    }

    //批量添加
    public void batchAll(List<Object[]> batchArgs){
        bookDao.batchAll(batchArgs);
    }
    public void batchUpdate(List<Object[]> batchArgs){
        bookDao.batchUpdate(batchArgs);
    }
    public void batchDelete(List<Object[]> batchArgs){
        bookDao.batchDelete(batchArgs);
    }


}
